package com.frame.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.frame.domain.MenuPermission;
import com.mini.core.dao.MiniDao;

/**
 * DAO for {@link MenuPermission}.
 */
@Service
public class MenuPermissionService{
	@Autowired
	MiniDao miniDao;
	
	/**
	 * 根据menuid查找所有权限
	 * @return
	 */
	public List<MenuPermission> findByMenuId(String menuid){
		String sql = "SELECT * FROM MENU_PERMISSION WHERE MENUID=?";
		return miniDao.findList(sql, MenuPermission.class,menuid);
	}

	/**
	 * 插入数据
	 * @param user
	 */
	public void save(MenuPermission menuperm) {
		miniDao.insert(menuperm);
	}

	/**
	 * 根据menuid删除记录
	 * @param menuid
	 */
	public void deleteByMenuid(String menuid) {
		miniDao.execute("DELETE FROM MENU_PERMISSION WHERE MENUID=?",menuid);
	}
}
